<!--# include virtual="/ceca_two/common/html/header.html"-->
<link rel="stylesheet" href="/ceca_two/css/governmentInformation.css" />
<!--banner-->
<!--# include virtual="/ceca_two/common/html/banner.html"-->
<!--分类-->
<!--# include virtual="/ceca_two/modules/materialPrice/base/filter.html"-->
<!--信息价-->
<div class="content">
	<div class="contentMain">
		<div class="priceTitle">
			<i id="guidanceName"></i>
			<div class="search">
				<input type="text" placeholder="输入感兴趣的内容或关键词" class="sou" />
				<span class="searchButton">搜索</span>
			</div>
		</div>
		<div class="descriptionThis">
			<span class="title">本期说明：</span>
			<pre class="overflow" id="explains"></pre>
		</div>
		<span class="button"><i class="jian"></i><i class="buttonZ">展开</i></span>
		<div class="allMessage">
			<div class="messageLeft">
				<span class="navTitle">全部信息价</span>
				<ul class="layui-nav layui-nav-tree" id="catalogTree"></ul>
			</div>
			<div class="messageRight">
				<table class="table">
					<thead>
						<tr>
							<td>名称</td>
							<td>规格型号</td>
							<td>单位</td>
							<td>税率%</td>
							<td>除税价</td>
							<td>含税价</td>
							<td>历史价</td>
							<td>备注</td>
						</tr>
					</thead>
					<tbody id="guidanceInfoText"></tbody>
				</table>
				<div id="laypage" style="margin-left: inherit;"></div>
			</div>
		</div>
	</div>
</div>
<!--底部-->
<!--# include virtual="/ceca_two/common/html/footer.html"-->
<script id="guidanceInfo" type="text/html">
	{{# for(var i = 0, len = d.length; i < len; i++){ }}
		<tr>
			<td>{{d[i].materialName}}</td>
			<td>{{d[i].specificcations}}</td>
			<td>{{d[i].units}}</td>
			<td>{{ }}</td>
			<td>{{#  if(d[i].nonTaxPrice){ }}{{d[i].nonTaxPrice}}{{#  } }}</td>  
			<td>{{d[i].taxPrice}}</td>
			<td class="picture">
				<img class="pictureI" src="/ceca_two/img/echars.png">
				<a href="governmentHistory.html" class="echartsPic">
				</a>
			</td>
			<td>{{d[i].remarks}}</td>
		</tr>
	{{# } }}
</script>
<script>
layui.use(['element', 'Index', 'GovernmentInformation','Router','filter','Zarea','Zutil','laytpl','laypage'], function() {
	var Router = layui.Router;
	var filter = layui.filter;
	var Zarea = layui.Zarea;
	var Zutil = layui.Zutil;
	var laytpl = layui.laytpl;
	var laypage =layui.laypage;
	var catalogTree = layui.GovernmentInformation;
	
	var Url=Router.link.materialPrice.getGuidance;
	var nowCity = sessionStorage.getItem("nowCity");
	var areaCode= nowCity == null | nowCity == "null"?110000:jQuery.parseJSON(nowCity).adcode;
	var data = {
		//"year":Zutil.getYear(),
		//"month":Zutil.getMonth()+"月",
		"areaCode":areaCode
	}
	var obj ={};
	console.log(obj.pageNumber)
	obj.pageNumber = obj.pageNumber|| 1;
	obj.pageSize = obj.pageSize || 10;
	//初始化数据
	$.post(Url,data,function(result){
		if(result.data.length > 0){
			var first =result.data[0];
			//$("#areaList").append("<i  style='color:red'>"+Zarea.getCityByCode(first.areaCode)+"</i>");
			//$("#majorList").append("<i style='color:red'>"+first.major+"</i>");
			//$("#gunidanceList").append("<i style='color:red' data-guidance="+first.guidanceId+">"+first.year+"-"+first.month+"</i>");
			$("#guidanceName").html(first.guidanceName);
			$("#explains").html(first.explains);
			var guidanceId = first.guidanceId;
			getList(obj);
			var catalogUrl=Router.link.materialPrice.getGuidanceCatalog;
			$.post(catalogUrl,{"guidanceId":"1497492719189000"},function(result){
				catalogTree.reptain(result.data);
			});
		}
	});
	$(".searchButton").click(function(){
		obj.key =  $(".search input").val().trim();
		getList(obj);
	});
	
	function getList(obj){  //信息价搜索方法	
		$.post(Router.link.materialPrice.searchGuidanceInfo,obj,function(result){
			console.log(result)
			var  data = result.data;
			laytpl(guidanceInfo.innerHTML).render(data.list, function(html){guidanceInfoText.innerHTML=html;});
			
			laypage({
			    cont: 'laypage'
			    ,pages: data.totalPage
			    ,curr:data.pageNumber
			    ,groups:data.pageSize
			    ,skin: '#ff0000'
			    ,jump: function(opt, first){
				    var curr = opt.curr;   //得到了当前页，用于向服务端请求对应数据
				    obj.pageNumber = curr|| 1;
				    if(!first)getList(obj);
				  }
			});
		});
	}
});
</script>
</body>
</html>